<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<style>
	/* 控制删除按钮的样式 */
	span.uploadcancel {
		width: 20px;
	    height: 17px;
	    display: inline-block;
	    background: url(images/icons.png) no-repeat;
		background-position: -48px 0px;
		cursor:pointer;
	}
</style>
<script type="text/javascript">
	//上传成功的回调函数
	function webuploadSuccezA( file,response ) {
		var acal=$("#AccessoryCaListA");
 		var val=acal.val();
 		var t="{\"extendId\":\""+file.id+"\",\"accessoryCAId\":\"" + response.accessoryCAId + "\",\"articleId\":\"" + response.articleId + "\"}";
		if(val==""){
			acal.val(t);
		}else{
			acal.val(val+","+t);
		}
	}
	//上传失败的回调函数
	function webuploadErrA( file,response ) {
		
	}
</script>

<!-- 用来存储物件id的隐藏域 -->
<input id="AccessoryCaListA" name="AccessoryCaList" value="" hidden="hidden" >
<table>
<c:forEach items="${requestScope.DictionariesArticleA}" var="item" varStatus="status" >

		<tr>
			<td class="td_c_l">${item.article }</td>
			<td style="text-align: left;">
				<!--上传附件部分-->
				<div id="uploader-demo">
				    <!--用来存放item-->
				    <div id="fileListA<c:out value="${status.index}"/>" class="uploader-list"></div>
				    <div id="listA<c:out value="${status.index}"/>"></div>
				    <input id="ArticleIdA<c:out value="${status.index}"/>" type="text" value="${item.id }" hidden="hidden" />
				    <div id="filePickerA<c:out value="${status.index}"/>">选择图片</div>
				</div>
				<script type="text/javascript">
					$(function(){
						//向后台传入的参数 有需要可是用一下
						var data={ArticleId:$("#ArticleId<c:out value="${status.index}"/>").val()};
						webupload("#filePickerA<c:out value="${status.index}"/>","#listA<c:out value="${status.index}"/>",data,"project/accessoryCa/addAccessoryCa",webuploadSuccezA,webuploadErrA);
						//当刚开始这个div没有被展示 display=none时 这个div的宽高会为0，导致不能点击，所以要手动设置高度
						$("div[id^=filePicker] div").css({"width":"78px","height":"37px"});
					});
				</script>
			</td>
		</tr>
</c:forEach>
</table>